package cn.glc.daily.life.web.service.captcha.abs;

import cn.glc.daily.life.model.dto.SendCodeDto;
import lombok.extern.slf4j.Slf4j;

import java.util.Optional;

/**
 * 短信发送实现
 *
 * @author simon
 * @date 2020/6/1 16:27
 * @copyright:
 * @modifier
 * @motto a no talent, people who have to study hard
 */
@Slf4j
public abstract class AbstractSmsCodeSend extends AbstractSendCode {

    @Override
    protected boolean vail(SendCodeDto sendCode) {
        return super.vail(sendCode);
    }

    @Override
    public boolean send(SendCodeDto sendCode) {
        Optional.ofNullable(vail(sendCode)).orElseThrow(() -> new IllegalArgumentException());
        log.info("手机验证码发送成功");
        return true;
    }

    @Override
    protected boolean destroy(SendCodeDto sendCode) {
        return super.destroy(sendCode);
    }
}
